<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #canvas{
      margin: 100px auto;
      background: #999;
      display: block;
    }
  </style>
</head>
<body>

  <canvas id="canvas"></canvas>

  <script>
    // 获得canvas
    const canvas = document.querySelector('#canvas');
    canvas.width = 400;
    canvas.height = 400;
    // 获得绘制的上下文
    const context = canvas.getContext('2d');

    context.clearRect(0, 0, 400, 400);

    

      

      context.beginPath();
      // 大圆
      context.moveTo(200, 200);
      context.arc(200, 200, 120, 0, Math.PI * 2, false);
      context.lineTo(200, 200);
      // 小圆
      context.moveTo(200, 200);
      context.arc(200, 200, 100, 0, Math.PI * 2, false);
      context.lineTo(200, 200);
      context.fillStyle = '#ff0';
      context.fill('evenodd');
      context.closePath();


    
      let x = 360 * 0.5;

      console.log('绘制红色圆环。。。。。');

      context.beginPath();
      // 大扇形
      context.moveTo(200, 200);
      context.arc(200, 200, 120, Math.PI / 180 * -90, Math.PI / 180 * (-90 + x), false);
      context.lineTo(200, 200);
      // 小扇形
      context.moveTo(200, 200);
      context.arc(200, 200, 100, Math.PI / 180 * -90, Math.PI / 180 * (-90 + x), false);
      context.lineTo(200, 200);

      context.fillStyle = '#f00';
      context.fill('evenodd');
      context.closePath();
      


    // 0 ~ 1

    // 0.2



  </script>
  
</body>
</html>